package com.beyond.trace.dy.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.beyond.trace.dy.mapper.TraceDySaleMapper;
import com.beyond.trace.dy.domain.TraceDySale;
import com.beyond.trace.dy.service.ITraceDySaleService;

/**
 * 销售单Service业务层处理
 * 
 * @author Mr.Yao
 * @date 2022-04-09
 */
@Service
public class TraceDySaleServiceImpl extends ServiceImpl<TraceDySaleMapper, TraceDySale> implements ITraceDySaleService
{
    @Resource
    private TraceDySaleMapper traceDySaleMapper;

    /**
     * 查询销售单
     * 
     * @param saleId 销售单ID
     * @return 销售单
     */
    @Override
    public TraceDySale selectTraceDySaleById(Long saleId)
    {
        return traceDySaleMapper.selectTraceDySaleById(saleId);
    }

    /**
     * 查询销售单列表
     * 
     * @param traceDySale 销售单
     * @return 销售单
     */
    @Override
    public List<TraceDySale> selectTraceDySaleList(TraceDySale traceDySale)
    {
        return traceDySaleMapper.selectTraceDySaleList(traceDySale);
    }

    /**
     * 新增销售单
     * 
     * @param traceDySale 销售单
     * @return 结果
     */
    @Override
    public boolean insertTraceDySale(TraceDySale traceDySale)
    {
        traceDySale.setCreateTime(DateUtils.getNowDate());
        //return traceDySaleMapper.insertTraceDySale(traceDySale);
        return super.save(traceDySale);
    }

    /**
     * 修改销售单
     * 
     * @param traceDySale 销售单
     * @return 结果
     */
    @Override
    public int updateTraceDySale(TraceDySale traceDySale)
    {
        traceDySale.setUpdateTime(DateUtils.getNowDate());
        return traceDySaleMapper.updateTraceDySale(traceDySale);
    }

    /**
     * 批量删除销售单
     * 
     * @param saleIds 需要删除的销售单ID
     * @return 结果
     */
    @Override
    public int deleteTraceDySaleByIds(Long[] saleIds)
    {
        return traceDySaleMapper.deleteTraceDySaleByIds(saleIds);
    }

    /**
     * 删除销售单信息
     * 
     * @param saleId 销售单ID
     * @return 结果
     */
    @Override
    public int deleteTraceDySaleById(Long saleId)
    {
        return traceDySaleMapper.deleteTraceDySaleById(saleId);
    }
}
